import { useLocation } from 'react-router-dom';

export default function useGetUrlParams() {
  const location = useLocation();
  // 使用URLSearchParams来解析查询字符串
  const query = new URLSearchParams(location.search);
  // 从查询字符串中获取id参数
  const id = query.get('id') || null;

  return {
    query,
    id,
  };
}
